/*
 * Copyright (C) 2010-2016 Softtek Information Systems (Wuxi) Co.Ltd.
 * Date:2016-03-31
 */

package com.jarvis.hospital.servers;

import com.jarvis.hospital.common.FileResponseData;
import com.jarvis.hospital.common.ResponseData;
import com.jarvis.hospital.login.model.FileModel;
import com.jarvis.hospital.login.model.LoginModel;
import com.jarvis.hospital.patient.model.MessageListModel;
import com.jarvis.hospital.patient.model.PatientListModel;
import com.jarvis.hospital.patient.model.TaskListModel;
import com.jarvis.hospital.prescription.model.AllBloodModel;
import com.jarvis.hospital.prescription.model.AllPrescriptionModel;
import com.jarvis.hospital.prescription.model.BloodIntervalListModel;
import com.jarvis.hospital.prescription.model.BloodTimeModel;
import com.jarvis.hospital.prescription.model.CFIntervalListModel;
import com.jarvis.hospital.prescription.model.CommentListModel;
import com.jarvis.hospital.prescription.model.DefaultPrescriptionModel;
import com.jarvis.hospital.prescription.model.EditPrescriptionRequestModel;
import com.jarvis.hospital.prescription.model.MedicineBasicListModel;
import com.jarvis.hospital.prescription.model.MedicineStockListModel;
import com.jarvis.hospital.prescription.model.PerfusionIntervalListModel;
import com.jarvis.hospital.prescription.model.PrescriptionInfoModel;
import com.jarvis.hospital.prescription.model.PrescriptionModel;
import com.jarvis.hospital.prescription.model.PrescriptionTimeModel;
import com.jarvis.hospital.prescription.model.AddNewPrescriptionRequestModel;
import com.jarvis.hospital.prescription.model.UnreadCountModel;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * Created by jarvis.liu on 9/13/2016.
 */
public interface ApiService {
//    //版本更新
//    @POST("DataRequestHandler")
//    Call<ResponseData<UpdateModel>> update(@Body RequestUpdateModel model);

    //上传单图接口
    @POST("files/upload")
    @Multipart
    Call<FileResponseData<List<FileModel>>> uploadImage(@Part List<MultipartBody.Part> partList);

    /**
     * 1.    登录
     */
    @GET("user/login")
    Observable<ResponseData<LoginModel>> doLogin(
            @Query("phoneNumber") String phoneNumber,
            @Query("identifyCode") String identifyCode,
            @Query("loginType") String loginType
    );

    /**
     * 2.	登出
     */
    @GET("user/loginOut")
    Observable<ResponseData> loginOut(@Query("loginType") String loginType);
    /**
     * 25.	更新用户信息（updateUserInfo）
     */
    @GET("user/updateUserInfo")
    Observable<ResponseData> updateUserInfo(@Query("userHeadimg") String userHeadimg);


    //4.	短信发送接口（SendMessage）
    @POST("sms/SendMessage")
    Observable<ResponseData> sendSms(
            @Query("phoneNumber") String phoneNumber,
            @Query("currentTime") String currentTime,
            @Query("secretToken") String secretToken
    );

    //9.	获取病人显示list（getPatientListByDoctor）
    @GET("doctor/getPatientListByDoctor")
    Observable<ResponseData<PatientListModel>> getPatientListByDoctor(@Query("doctorId") String doctorId,
                                                                      @Query("searchParaName") String searchParaName);

    //10.	获取默认方案list（getDefaultProgrammeList）
    @GET("doctor/getDefaultProgrammeList")
    Observable<ResponseData<PrescriptionModel>> getDefaultProgrammeList();

    //11.	获取默认方案详情（getDefaultProgrammeInfo）
    @GET("doctor/getDefaultProgrammeInfo")
    Observable<ResponseData<DefaultPrescriptionModel>> getDefaultProgrammeInfo(@Query("programmeId") String programmeId);

    //13.	获取灌注持续时间间隔值（getPerfusionIntervalList）
    @GET("doctor/getPerfusionIntervalList")
    Observable<ResponseData<PerfusionIntervalListModel>> getPerfusionIntervalList();

    //14.	获取解救时间间隔值（getRescueIntervalList）
    @GET("doctor/getRescueIntervalList")
    Observable<ResponseData<CFIntervalListModel>> getRescueIntervalList();

    //12.	获取采血时间间隔值（getBloodIntervalList）
    @GET("doctor/getBloodIntervalList")
    Observable<ResponseData<BloodIntervalListModel>> getBloodIntervalList();

    //15.	获取处方list（getPrescriptionList）
    @GET("doctor/getPrescriptionList")
    Observable<ResponseData<AllPrescriptionModel>> getPrescriptionList(@Query("currentPage") int currentPage,
                                                                       @Query("pageSize") int pageSize,
                                                                       @Query("status") int status,
                                                                       @Query("userId") String userId);
    //31.	获取采血数据list（startPrescriptionPlan）
    @GET("docimaster/getBloodDoneList ")
    Observable<ResponseData<AllBloodModel>> getBloodDoneList (@Query("currentPage") int currentPage,
                                                              @Query("pageSize") int pageSize,
                                                              @Query("status") int status);

    //16.	获取处方详情-上半部分（getPrescriptionInfo）
    @GET("doctor/getPrescriptionInfo")
    Observable<ResponseData<PrescriptionInfoModel>> getPrescriptionInfo(@Query("prescriptionId") String prescriptionId);

    //17.	获取处方详情-时间轴数据（getPrescriptionTimeAxis）
    @GET("doctor/getPrescriptionTimeAxis")
    Observable<ResponseData<PrescriptionTimeModel>> getPrescriptionTimeAxis(@Query("prescriptionId") String prescriptionId);

    //18.	获取用户A和用户B的聊天列表（getMessage）
    @GET("chat/getMessage")
    Observable<ResponseData<MessageListModel>> getMessage(@Query("currentPage") int currentPage,
                                                          @Query("pageSize") int pageSize,
                                                          @Query("smsSenderId") String smsSenderId,
                                                          @Query("smsReceiverId") String smsReceiverId);

    //18.	获取当前用户消息首页聊天列表（getMessageList）
    @GET("chat/getMessageList")
    Observable<ResponseData<MessageListModel>> getMessageList(@Query("currentPage") int currentPage,
                                                          @Query("pageSize") int pageSize,
                                                          @Query("userId") String userId,
                                                          @Query("content") String content);
    //33.	获取吃药计划数据list（getMedicineList）
    @GET("patient/getMedicineList")
    Observable<ResponseData<TaskListModel>> getMedicineList(@Query("currentPage") int currentPage,
                                                        @Query("pageSize") int pageSize,
                                                        @Query("userId") String userId);

    //30.	获取药品出入库数据list（getMedicineStockLog）
    @GET("pharmacist/getMedicineStockLog")
    Observable<ResponseData<MedicineStockListModel>> getMedicineStockLog(@Query("currentPage") int currentPage,
                                                                         @Query("pageSize") int pageSize);

    //30.	获取药品出入库数据list（getMedicineBasicList）
    @GET("pharmacist/getMedicineBasicList")
    Observable<ResponseData<MedicineBasicListModel>> getMedicineBasicList();

    //32.	添加药品入库（addMedicineStock）
    @GET("pharmacist/addMedicineStock")
    Observable<ResponseData> addMedicineStock(@Query("medicineId") String medicineId,
                                              @Query("medicineName") String medicineName,
                                              @Query("medicineDose") String medicineDose);

    //19.	用户A和用户B的聊天接口（sendMessage）
    @GET("chat/sendMessage")
    Observable<ResponseData> sendMessage(@Query("smsContent") String smsContent,
                                         @Query("smsSenderId") String smsSenderId,
                                         @Query("smsReceiverId") String smsReceiverId);

    //21.	获取某个处方下方的评论列表（getComment）
    @GET("comment/getComment")
    Observable<ResponseData<CommentListModel>> getComment(@Query("currentPage") int currentPage,
                                                          @Query("pageSize") int pageSize,
                                                          @Query("prescriptionId") String prescriptionId);

    //20.	用户评论处方或者评论其他用户的评论（sendComment）
    @GET("comment/sendComment")
    Observable<ResponseData> sendComment(@Query("ownerUserId") String ownerUserId,
                                         @Query("prescriptionId") String prescriptionId,
                                         @Query("commentType") String commentType,
                                         @Query("parentId") String parentId,
                                         @Query("content") String content,
                                         @Query("targetUserId") String targetUserId
                                         );
    //22.	删除某条评论（delComment）
    @GET("comment/delComment")
    Observable<ResponseData> delComment(@Query("commentId") String commentId,
                                         @Query("userId") String userId
                                         );

    //24.	发布新的处方（addNewPrescription）
    @POST("doctor/addNewPrescription")
    Observable<ResponseData> addNewPrescription(@Body AddNewPrescriptionRequestModel model);
    //25.	编辑处方（editPrescription）
    @POST("doctor/editPrescription")
    Observable<ResponseData> editPrescription(
            @Body EditPrescriptionRequestModel model

    );
    //24.	发布新的处方（addNewPrescription）
    @FormUrlEncoded
    @POST("doctor/addNewPrescription")
    Observable<ResponseData> addNewPrescriptions(
            @Field("userId") String userId,
            @Field("patientId") String patientId,
            @Field("MTXdose") String MTXdose,
            @Field("MTXTimeDuration") String MTXTimeDuration,
            @Field("CFdose") String CFdose,
            @Field("CFTimeInterval") String CFTimeInterva,@Field("listBloodTime") List<BloodTimeModel> listBloodTime
                                         );

    //25.	编辑处方（editPrescription）
    @FormUrlEncoded
    @POST("doctor/editPrescription")
    Observable<ResponseData> editPrescriptions(
            @Field("userId") String userId,
            @Field("programmeId") String programmeId,
            @Field("prescriptionId") String prescriptionId,
            @Field("patientId") String patientId,
            @Field("MTXdose") String MTXdose,
            @Field("MTXTimeDuration") String MTXTimeDuration,
            @Field("CFdose") String CFdose,
            @Field("CFTimeInterval") String CFTimeInterva,@Field("listBloodTime") List<BloodTimeModel> listBloodTime
                                         );
    //28.	获取首页的未读数（消息未读、处方未读）
    @GET("pharmacist/getUnreadCount")
    Observable<ResponseData<UnreadCountModel>> getUnreadCount();
    //29.	审核医生发布的处方（reviewPrescriptionStatus）
    @GET("pharmacist/reviewPrescriptionStatus")
    Observable<ResponseData> reviewPrescriptionStatus(@Query("prescriptionId") String prescriptionId,
                                                      @Query("programmeId") String programmeId,
                                                      @Query("status") String status,
                                                      @Query("option") String option
    );
    //30.	设置处方的启动时间（startPrescriptionPlan）
    @GET("nurse/startPrescriptionPlan")
    Observable<ResponseData> startPrescriptionPlan(@Query("prescriptionId") String prescriptionId,
                                                      @Query("startTime") String startTime
    );
    //32.	上传检验结果（updateBloodCheckResult）
    @GET("docimaster/updateBloodCheckResult")
    Observable<ResponseData> updateBloodCheckResult(@Query("bloodId") String bloodId,
                                                      @Query("bloodAnalysisPic") String bloodAnalysisPic,
                                                      @Query("bloodAnalysisText") String bloodAnalysisText
    );
}
